﻿@using RooHui.Infrastructure.Entities.Enum
@{
    ViewBag.Title = "Index";
    Layout = "~/Views/Shared/_Member.cshtml";
    RooHui.Infrastructure.Entities.Entity.Member member = ViewBag.Member;
}
@section head{
    <link rel="stylesheet" href="/content/css/memberStyle.css" />
}
<div class="container" style="margin-top: 20px;">
    @if (!member.HandPhoneCheck || !member.IDCardCheck)
    {
        <div class="alert alert-info fade in">
            @if (!member.HandPhoneCheck)
            {
                @:您还未完成 <a class="orange" href="/member/setmobile">手机认证</a>.
    <br />
            }
            @if (!member.IDCardCheck)
            {
                if (!String.IsNullOrEmpty(member.IDCardNo))
                {
                @:您的实名认证<span class="orange">申请处理中</span>.
        }
                else
                { 
                @:您还未完成 <a class="orange" href="/member/setauth">实名认证</a>.
                    }
            }
        </div>
    }
    else
    { 
        <div class="alter alter-success fade in">
            您已经完成了所有的安全认证
        </div>
    }
    <blockquote style="padding-left: 0px;">
        <div style="padding: 15px; border-top: 1px solid #eee; border-bottom: 1px solid #eee;
            border-right: 1px solid #eee;">
            <h5>
                @{
                    int hour = DateTime.Now.Hour;
                }
                @if (hour >= 0 && hour < 6)
                {
                    @:早上好，@member.RealName 吃口早餐，为新的一天做好准备！
            }
                else if (hour >= 6 && hour < 12)
                {
                    @:上午好，@member.RealName 辛勤的工作，为了更加美好的明天！
            }
                else if (hour >= 12 && hour < 14)
                {
                    @:中午好，@member.RealName 吃完午饭小憩一会为下午补充能量！
            }
                else if (hour >= 14 && hour < 18)
                {
                    @:下午好，@member.RealName 沏杯茶，让精神抖擞起来！
            }
                else if (hour >= 18 && hour < 24)
                {
                    @:晚上好，@member.RealName 充分利用时间，将收获更多的幸福！
                            }
            </h5>
            <hr style="margin: 5px 0;" />
            <div class="row-fluid">
                <div class="span5">
                    账号名： @HttpContext.Current.User.Identity.Name
                    @if (member.IDCardCheck)
                    {
                        <span class="label label-info"><i class="icon-user label-info"></i>&nbsp;已实名</span>
                    }
                    else
                    {
                        if (!String.IsNullOrEmpty(member.IDCardNo))
                        {
                        <span class="label"><i class="icon-user"></i>&nbsp;实名中</span>
                        }
                        else
                        {
                        <a href="/member/setauth"><span class="label"><i class="icon-user"></i>&nbsp;未实名</span></a>
                        }
                    }
                    @if (member.HandPhoneCheck)
                    {
                        <span class="label label-info"><i class="icon-mobile-phone"></i>&nbsp;手机已认证</span>
                    }
                    else
                    {
                        <a href="/member/setmobile"><span class="label"><i class="icon-mobile-phone"></i>&nbsp;手机未认证</span></a>
                    }
                    <span class="label label-info"><i class="icon-envelope"></i>&nbsp;邮箱已认证</span>
                </div>
                <div class="span4">
                    第三方支付账号： @HttpContext.Current.User.Identity.Name (汇付天下)
                </div>
                <div class="span3">
                    上次登录时间： @(((RooHui.Infrastructure.Entities.Entity.MemberLog)ViewBag.MemberLog).OperateTime.ToString("yyyy.MM.dd HH:mm:ss"))
                </div>
            </div>
        </div>
    </blockquote>
    <div class="tag-box tag-box-v3">
        <div class="row-fluid">
            <div class="span6">
                @{
                    RooHui.Infrastructure.Entities.Entity.Account account = ViewBag.Capital;
                }
                <div class="span12" style="height: 46px; line-height: 46px; border-bottom: 1px solid #eee;">
                    <h2>
                        账户可用余额： <span class="orange" style="font-size: 24px; font-weight: bold;">@account.BalanceAmount.ToString("F2")</span>
                        <a href="/member/recharge" class="btn-u btn-u-orange" style="margin-bottom: 6px;">充值</a>
                        <a href="/member/withdraw" class="btn-u" style="margin-bottom: 6px;">提现</a>
                    </h2>
                </div>
                <div class="span12" style="margin-left: 0; height: 46px; line-height: 46px;">
                    <div class="span4">
                        总资产： @((account.BalanceAmount + account.FrozenAmount + account.Accrual + account.Corpus).ToString("F2"))</div>
                    <div class="span8">
                        冻结资金： @account.FrozenAmount.ToString("F2") (@account.FrozenCount 笔投资)</div>
                </div>
            </div>
            <div class="span6">
                <div class="span12" style="height: 46px; line-height: 46px;">
                    总收益额： <span style="color: #0078ff; font-size: 26px; font-weight: bolder;">@account.TotalAccrual.ToString("F2")</span>
                </div>
                <div class="span12 " style="margin-left: 0; height: 46px; line-height: 46px;">
                    总投资额： <span style="color: #ff7800; font-size: 26px; font-weight: bolder;">@account.TotalCorpus.ToString("F2")</span>
                </div>
            </div>
        </div>
    </div>
    <div class="row-fluid">
        <div class="span7">
            <div class="span6">
                <div class="widget widget-table">
                    <div class="widget-header">
                        <h3>
                            投标概况</h3>
                        <span><a href="/member/invest" title="查看详情"><i class="icon-list"></i></a></span>
                    </div>
                    <div class="widget-content">
                        @{
                            RooHui.Portal.Biz.Model.InvestmentInfoModel investment = ViewBag.Investment;
                        }
                        <table class="table">
                            <thead>
                                <tr>
                                    <th style="width: 40px">
                                        状态
                                    </th>
                                    <th style="width: 40px">
                                        笔数
                                    </th>
                                    <th style="text-align: right;">
                                        金额
                                    </th>
                                </tr>
                            </thead>
                            <tbody>
                                <tr>
                                    <td>
                                        <a href="/member/invest?type=1">投标中</a>
                                    </td>
                                    <td>
                                        @investment.Invest.Count
                                    </td>
                                    <td style="text-align: right">
                                        @investment.Invest.Amount.ToString("F2")
                                    </td>
                                </tr>
                                <tr>
                                    <td>
                                        <a href="/member/invest?type=2">回款中</a>
                                    </td>
                                    <td>
                                        @investment.Repayment.Count
                                    </td>
                                    <td style="text-align: right">
                                        @investment.Repayment.Amount.ToString("F2")
                                    </td>
                                </tr>
                                <tr>
                                    <td>
                                        <a href="/member/invest?type=3">已完成</a>
                                    </td>
                                    <td>
                                        @investment.Complete.Count
                                    </td>
                                    <td style="text-align: right">
                                        @investment.Complete.Amount.ToString("F2")
                                    </td>
                                </tr>
                                <tr>
                                    <td>
                                        总计
                                    </td>
                                    <td>
                                        @investment.Total.Count
                                    </td>
                                    <td style="text-align: right;">
                                        @investment.Total.Amount.ToString("F2")
                                    </td>
                                </tr>
                            </tbody>
                        </table>
                    </div>
                </div>
            </div>
            <div class="span6">
                <div class="widget widget-table">
                    <div class="widget-header">
                        <h3>
                            待回款</h3>
                        <span><a href="/member/repayment" title="查看详情"><i class="icon-list"></i></a></span>
                    </div>
                    <div class="widget-content">
                        @{
                            RooHui.Portal.Biz.Model.PayBackInfomodel paybackItem = ViewBag.Repayment;
                        }
                        <table class="table">
                            <thead>
                                <tr>
                                    <th style="width: 40px">
                                        时间
                                    </th>
                                    <th style="width: 40px">
                                        笔数
                                    </th>
                                    <th style="text-align: right;">
                                        金额
                                    </th>
                                </tr>
                            </thead>
                            <tbody>
                                <tr>
                                    <td>
                                        <a target="_blank" href="/member/repayment?start=@(paybackItem.ThisMonth.startDate.ToString("yyyy/MM/dd"))&end=@(paybackItem.ThisMonth.endDate.ToString("yyyy/MM/dd"))">
                                            本月</a>
                                    </td>
                                    <td style="">
                                        @paybackItem.ThisMonth.Count
                                    </td>
                                    <td style="text-align: right;">
                                        @paybackItem.ThisMonth.Amount.ToString("F2")
                                    </td>
                                </tr>
                                <tr>
                                    <td>
                                        <a target="_blank" href="/member/repayment?start=@(paybackItem.NextMonth.startDate.ToString("yyyy/MM/dd"))&end=@(paybackItem.NextMonth.endDate.ToString("yyyy/MM/dd"))">
                                            下月</a>
                                    </td>
                                    <td style="">
                                        @paybackItem.NextMonth.Count
                                    </td>
                                    <td style="text-align: right;">
                                        @paybackItem.NextMonth.Amount.ToString("F2")
                                    </td>
                                </tr>
                                <tr>
                                    <td>
                                        <a target="_blank" href="/member/repayment?start=@(paybackItem.AllYearMonth.startDate.ToString("yyyy/MM/dd"))&end=@(paybackItem.AllYearMonth.endDate.ToString("yyyy/MM/dd"))">
                                            本年</a>
                                    </td>
                                    <td style="">
                                        @paybackItem.AllYearMonth.Count
                                    </td>
                                    <td style="text-align: right;">
                                        @paybackItem.AllYearMonth.Amount.ToString("F2")
                                    </td>
                                </tr>
                                <tr>
                                    <td>
                                        <a target="_blank" href="/member/repayment">总计</a>
                                    </td>
                                    <td style="">
                                        @paybackItem.TotalMonth.Count
                                    </td>
                                    <td style="text-align: right;">
                                        @paybackItem.TotalMonth.Amount.ToString("F2")
                                    </td>
                                </tr>
                            </tbody>
                        </table>
                    </div>
                </div>
            </div>
        </div>
        <div class="span5">
            <div class="widget widget-table">
                <div class="widget-header">
                    <h3>
                        最近交易</h3>
                    <span><a href="/member/activity" title="查看详情"><i class="icon-list"></i></a></span>
                </div>
                <div class="widget-content" style="height: 185px">
                    @{
                        RooHui.Infrastructure.Entities.ItemListBox<RooHui.Infrastructure.Entities.Entity.AmountOperation>
                            operations = ViewBag.AccountOperations;
                        if (operations == null || operations.Data == null || !operations.Data.Any())
                        {
                        <div style="margin-top: 70px; text-align: center;">
                            您最近没有交易
                        </div>
                        }
                        else
                        {
                        <table class="table">
                            <thead>
                                <tr>
                                    <th style="width: 140px">
                                        时间
                                    </th>
                                    <th>
                                        类型
                                    </th>
                                    <th style="text-align: right; padding-right: 10px;">
                                        金额
                                    </th>
                                </tr>
                            </thead>
                            <tbody>
                                @foreach (var item in operations.Data)
                                { 
                                    <tr>
                                        <td>
                                            @item.PayBackTime.ToString("yyyy.MM.dd HH:mm")
                                        </td>
                                        <td>
                                            @item.OperationType.Mapping()
                                        </td>
                                        <td style="text-align: right; padding-right: 10px;">
                                            @Html.Raw(RooHui.Portal.WebLogic.Style.MakeAmountOperationStyle(item.Amount, item.OperationType))
                                        </td>
                                    </tr>
                                }
                            </tbody>
                        </table>
                        }
                    }
                </div>
            </div>
        </div>
    </div>
</div>
@section scripts{
    <script type="text/javascript">
        $(function () {
            $('#labhome').addClass('active');
        });
    </script>
}
